home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / make / icmake-6.000 / icmake-6 / icmake / rss / programn.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-08  |  1.2 KB  |  50 lines

  1. /*                       P R O G R A M N . C
  2.     ported to non-MSDOS systems pwp 93 07 15
  3.  
  4.     % 1 name
  5. \functoc {program\_name}
  6.     % 2 declaration
  7. {char * \fname (\params\ )}
  8.     % 3 arguments
  9. {{char *}{argv0}{The full pathname of the program, as given by, e.g.,
  10.                  \Var{argv[0]}}
  11. }
  12.     % 4 return value
  13. {A pointer to only the basename of the program.}
  14.     % 5 functions used
  15. {}
  16.     % 6 see also
  17. {}
  18.     % 7 source file
  19. {programn.c}
  20.     % 8 description
  21. {The function modifies the full pathname of the program by removing the
  22. extension (e.g., {\sc .exe}), and returns a pointer to the first character of
  23. the basename of the function.
  24.  
  25.     Note well that the extension is removed from the original string, and that
  26.     the returned pointer points sowhere inside the original string.
  27.  
  28.     The function {\em assumes\,} a path in which at least one DIRSEP
  29.     precedes the first character of the program name.
  30.     The program name may or may notr have an extension.
  31.     This is not checked.
  32. }
  33. */
  34. #ifndef MSDOS
  35.  
  36. #include <stdio.h>
  37. #include <string.h>
  38. #include "icrss.h"
  39.  
  40. char *program_name(char *argv)
  41. {
  42.     register char
  43.         *d;
  44.         
  45.     if ( (d = strrchr (argv, DIRSEP)) )
  46.         return (d + 1);
  47.     return (argv);
  48. }
  49. #endif
  50.